package cn.xxluckey;

import cn.xxluckey.util.TimeUtil;

public class TimeTest {
    public static void main(String[] args) {
        // 时间编码
        byte[] timeData = TimeUtil.encodeTime(2023, 12, 19, 14, 45, 0, 123);
        System.out.println("时间编码结果: " + bytesToHex(timeData));

        // 时间解码
        String decodedTime = TimeUtil.decodeTime(timeData);
        System.out.println("解码后的时间: " + decodedTime);
    }

    private static String bytesToHex(byte[] bytes) {
        StringBuilder sb = new StringBuilder();
        for (byte b : bytes) {
            sb.append(String.format("%02X ", b));
        }
        return sb.toString().trim();
    }
}
